import request from '@/utils/request';
import Server from "@/config/server";


export const userLogin = data => request.post('v1/passport/login', data); // 用户登录

export function userDetail(parameter){
    return request({
        url: 'v1/passport/detail',
        method: 'get',
        data: parameter,
    });
}


export function logout(){
    return request({
        url: 'v1/passport/logout',
        method: 'get',
    });
}

// 用户注册
export const userRegister = data => request.post('v1/passport/userRegister', data);
//注册验证码
export function getSmsCaptcha (parameter) {
    console.log(parameter);
    return request.get(
        'v1/phone/getPhoneCode', 
        { params: parameter }
    )
}
//用户权限信息
export const getInfo = data => request.get(Server.action.user_permission, data);
// 忘记密码
export const upForgetPassword = data => request.post('v1/passport/upForgetPassword', data);
// 忘记密码验证码
export const getForgetCode = data => request.get('v1/phone/setForgetCode',{ params: data });

// 右上角信息接口
export const unread = data => request.get('v1/news/unread');
// 右上角报警未读
export const alarmRecord = data => request.get('v1/alarmRecord/unreadRecord');
//获取验证码图片
export const getCodeImg = data => request.get('v1/captcha/checkImg');